﻿Imports KOR.Helpers

Namespace BL

    Public Module CoreDiameters

#Region "CoreDiameters_DML"

        Public Function InsertCoreDiameter(dict As Dictionary(Of String, Object)) As Integer
            Return DDA.Insert("CoreDiameters", dict)
        End Function

        Public Function UpdateCoreDiameter(dict As Dictionary(Of String, Object), CoreDiameterID As Integer) As Integer
            Return DDA.Update("CoreDiameters", dict, "CoreDiameterID=" & CoreDiameterID)
        End Function

        Public Function DeleteCoreDiameter(ByVal CoreDiameterID As Integer) As Integer
            Return DDA.Delete("CoreDiameters", "CoreDiameterID=" & CoreDiameterID, False)
        End Function

#End Region

#Region "LabelSizes_Selection"

        Public Function GetAllCoreDiameters() As IDataReader
            Dim sql As String = "SELECT * FROM CoreDiameters Order By CoreDiameterID DESC"
            Return DDA.SelectData(sql)
        End Function

        Public Function GetCoreDiameters(searchFor As String, criteria As String, startRowIndex As Integer, maximumRows As Integer, SortBy As String) As IDataReader
            Dim sql As String
            sql = "SELECT * FROM CoreDiameters "

            If SortBy = "" Then SortBy = " CreatedDate Desc"

            Return DDA.SelectDataPaginated(sql, startRowIndex, maximumRows, SortBy)
        End Function

        Public Function GetCoreDiametersCount(searchFor As String, criteria As String) As Integer
            Dim sql As String
            sql = "SELECT * FROM CoreDiameters "
            Return DDA.SelectDataCount(sql)
        End Function

#End Region

    End Module
End Namespace